import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import axiosViem from "@/views/axiosViem.vue";
import donghuaView from "@/views/donghuaView.vue";
import indexView from "@/views/indexView.vue";
import layOut from "@/layout/layOut.vue";
import pageA from "@/views/pageA.vue";
import pageB from "@/views/pageB.vue";
import pageC from "@/views/pageC.vue";



Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/lay/axios',
  },
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/axios',
    component: axiosViem
  },
  {
    path: '/donghua',
    component: donghuaView,

  },
  {
    path: '/index',
    component: indexView,
    children:[
      {
        path:'donghua',
        component:donghuaView
      },
      {
        path:'axios',
        component: axiosViem
      }
    ]
  },
  {
    path: '/lay',
    component: layOut,
    children: [
      {
        path:'axios',
        components:{
          default:donghuaView,
          HomeView,
          indexView

        }
      }
    ]
  },
  {
    path: '/pageA',
    component: pageA
  },
  {
    path: '/pageB',
    component: pageB
  },
  {
    path: '/pageC/:id',
    name: 'pageC',
    component: pageC
  }


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
